package com.xyzq.reks.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.appfuse.model.BaseObject;

@Entity
@Table(name = "account_assert")
public class AccountAssert extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4783181283999079743L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "FK_ACCOUNT_ACCOUNT", nullable = false)
	private Account account;
	@Column(name = "daily_assert", scale = 2)
	private Double dailyAssert;
	@Column(name = "daily_fund", scale = 2)
	private Double dailyFund;
	@Column(name = "daily_market_assert", scale = 2)
	private Double dailyMarketAssert;
	@Column(name = "daily_paper", scale = 2)
	private Double dailyPaper;
	@Column(name = "daily_money", scale = 2)
	private Double dailyMoney;
	private String month;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "sub_time")
	private Date subTime;

	public Long getId() {
		return id;
	}

	public Account getAccount() {
		return account;
	}

	public Double getDailyAssert() {
		return dailyAssert;
	}

	public Double getDailyFund() {
		return dailyFund;
	}

	public Double getDailyMarketAssert() {
		return dailyMarketAssert;
	}

	public Double getDailyPaper() {
		return dailyPaper;
	}

	public Double getDailyMoney() {
		return dailyMoney;
	}

	public String getMonth() {
		return month;
	}

	public Date getSubTime() {
		return subTime;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public void setDailyAssert(Double dailyAssert) {
		this.dailyAssert = dailyAssert;
	}

	public void setDailyFund(Double dailyFund) {
		this.dailyFund = dailyFund;
	}

	public void setDailyMarketAssert(Double dailyMarketAssert) {
		this.dailyMarketAssert = dailyMarketAssert;
	}

	public void setDailyPaper(Double dailyPaper) {
		this.dailyPaper = dailyPaper;
	}

	public void setDailyMoney(Double dailyMoney) {
		this.dailyMoney = dailyMoney;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public void setSubTime(Date subTime) {
		this.subTime = subTime;
	}

	@Override
	public String toString() {
		ToStringBuilder builder = new ToStringBuilder(this,
				ToStringStyle.DEFAULT_STYLE);
		builder.append("id", id);
		builder.append("account", account);
		builder.append("dailyAssert", dailyAssert);
		builder.append("dailyFund", dailyFund);
		builder.append("dailyMarketAssert", dailyMarketAssert);
		builder.append("dailyPaper", dailyPaper);
		builder.append("dailyMoney", dailyMoney);
		builder.append("month", month);
		builder.append("subTime", subTime);
		return builder.toString();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AccountAssert other = (AccountAssert) obj;
		if (account == null) {
			if (other.account != null)
				return false;
		} else if (!account.equals(other.account))
			return false;
		if (dailyAssert == null) {
			if (other.dailyAssert != null)
				return false;
		} else if (!dailyAssert.equals(other.dailyAssert))
			return false;
		if (dailyFund == null) {
			if (other.dailyFund != null)
				return false;
		} else if (!dailyFund.equals(other.dailyFund))
			return false;
		if (dailyMarketAssert == null) {
			if (other.dailyMarketAssert != null)
				return false;
		} else if (!dailyMarketAssert.equals(other.dailyMarketAssert))
			return false;
		if (dailyMoney == null) {
			if (other.dailyMoney != null)
				return false;
		} else if (!dailyMoney.equals(other.dailyMoney))
			return false;
		if (dailyPaper == null) {
			if (other.dailyPaper != null)
				return false;
		} else if (!dailyPaper.equals(other.dailyPaper))
			return false;
		if (month == null) {
			if (other.month != null)
				return false;
		} else if (!month.equals(other.month))
			return false;
		if (subTime == null) {
			if (other.subTime != null)
				return false;
		} else if (!subTime.equals(other.subTime))
			return false;
		return true;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((account == null) ? 0 : account.hashCode());
		result = prime * result
				+ ((dailyAssert == null) ? 0 : dailyAssert.hashCode());
		result = prime * result
				+ ((dailyFund == null) ? 0 : dailyFund.hashCode());
		result = prime
				* result
				+ ((dailyMarketAssert == null) ? 0 : dailyMarketAssert
						.hashCode());
		result = prime * result
				+ ((dailyMoney == null) ? 0 : dailyMoney.hashCode());
		result = prime * result
				+ ((dailyPaper == null) ? 0 : dailyPaper.hashCode());
		result = prime * result + ((month == null) ? 0 : month.hashCode());
		result = prime * result + ((subTime == null) ? 0 : subTime.hashCode());
		return result;
	}

}
